package com.yxhl.zoume.domain.interactor.car.officialcar;

import com.yxhl.zoume.data.http.repository.car.OfficialCarRepository;
import com.yxhl.zoume.data.http.rest.param.base.RequestParamImpl;
import com.yxhl.zoume.data.http.rest.param.officialcar.CancelOfficialCarOrderParam;
import com.yxhl.zoume.data.http.rest.response.specialcar.CancelOrderResponse;
import com.yxhl.zoume.domain.DomainConstants;
import com.yxhl.zoume.domain.interactor.base.UseCase;

import javax.inject.Inject;
import javax.inject.Named;

import rx.Observable;
import rx.Scheduler;

/**
 * 项目名称：Ferrari
 * Created by menggod on 16/8/23 .
 */
public class CancelOfficialCanOrderUseCase extends UseCase<CancelOrderResponse> {

    private OfficialCarRepository mOfficialCarRepository;

    @Inject
    public CancelOfficialCanOrderUseCase(
            @Named(DomainConstants.UI_THREAD) Scheduler uiThread,
            @Named(DomainConstants.EXECUTOR_THREAD) Scheduler executorThread,
            OfficialCarRepository officialCarRepository
    ) {
        super(uiThread, executorThread);
        mOfficialCarRepository = officialCarRepository;
    }

    @Override
    protected Observable<CancelOrderResponse> buildObservable(RequestParamImpl param) {
        return mOfficialCarRepository.cancelOfficialCarOrder((CancelOfficialCarOrderParam) param)
                .subscribeOn(executorThread)
                .observeOn(uiThread);
    }
}
